<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
    <button id="btn_1">警告框</button>
	<button id="btn_2">确认框</button>
	<button id="btn_3">输入框</button>
	<p id="p1"></p>
 </body>
  <script>
     var $ = function(obj){
	    return document.getElementById(obj);
	 }
	 window.onload = function(){
	    //警告框
		var btn_1 = $("btn_1");
		btn_1.onclick = function(){
			window.alert("你好，我是一个警告框");
		}
        //确认框
		var btn_2 = $("btn_2");
		p1 = $("p1");
		btn_2.onclick = function(){
		   var s= window.confirm("按下按钮");
		   if(s){
		      p1.innerText = s;
		   }else{
		     p1.innerText = s;
		   }
		}
	   //输入框
	   var btn_3 = $("btn_3");
	   btn_3.onclick = function(){
	     var f = window.prompt("这是一个输入框");
		 p1.innerText = f;
	   }
	 }
  </script>
</html>
